
#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics : enable
#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics : enable

__kernel void histogram( __global const uint *src,
         __global uint * gbuckets,
         uint min,
         uint max,
	 uint L,
	__local * lbuckets )
{
 uint idx = get_global_id(0);
 uint element = src[idx];
 uint index = ((element - min)/ (max - min)) * L;
 (void ) atom_inc( gbuckets + index );
}

